import * as constants from '../Constants'
import { get, GET_ONECHECK_LIST, GET_SAMPLE_MARKS } from '../../service/api'

export interface GetOneCheckList {
  type: constants.GetOneCheckList
  payload: Promise<any>
}
export interface GetOneCheckList_PENDING {
  type: constants.GetOneCheckList_PENDING
  payload: Promise<any>
}
export interface GetOneCheckList_FULFILLED {
  type: constants.GetOneCheckList_FULFILLED
  payload: any
}
export interface GetOneCheckList_Type {
  type: constants.GetOneCheckList_Type
  payload: number
}

export interface RECORD_OneCheck {
  type: constants.RECORD_OneCheck
  payload: Promise<any>
}

export interface RECORD_OneCheck_FULFILLED {
  type: constants.RECORD_OneCheck_FULFILLED
  payload: any
}

export type OneCheckAction = GetOneCheckList | 
  GetOneCheckList_FULFILLED | 
  GetOneCheckList_PENDING |
  GetOneCheckList_Type |
  RECORD_OneCheck |
  RECORD_OneCheck_FULFILLED

export function recordType(param: number): GetOneCheckList_Type {
  return {
    type: constants.GetOneCheckList_Type,
    payload: param
  }
}

export function recoreMakes(params: any): RECORD_OneCheck {
  return {
    type: constants.RECORD_OneCheck,
    payload: get(GET_SAMPLE_MARKS, params)
  }
}

export function getOneCheckList(param: any): GetOneCheckList {
  return {
    type: constants.GetOneCheckList,
    payload: get(GET_ONECHECK_LIST, param)
  }
}